Add tenant id to lambda context and structured log messages#540
Add tenant id to lambda context and structured log messages#540ramisa2108 merged 1 commit intoaws:mainfrom
Conversation
maxday
left a comment
There was a problem hiding this comment.
Awesome job @ramisa2108 ! 💯
I left only some small comments, let me know if that makes sense
| } | ||
| } | ||
|
|
||
| @Test |
| LambdaEnvironment.FUNCTION_VERSION, | ||
| request.getInvokedFunctionArn(), | ||
| clientContext | ||
| clientContext, |
There was a problem hiding this comment.
I think it would be great to leave the clientContext as the last parameter? This way we keep aws-related fields grouped. WDYT?
There was a problem hiding this comment.
Great suggestion. Updated.
| String functionVersion, | ||
| String invokedFunctionArn, | ||
| ClientContext clientContext | ||
| ClientContext clientContext, |
There was a problem hiding this comment.
same here, maybe it would be better to swap args
| mockResponse.setHeader("lambda-runtime-aws-request-id", "1234567890"); | ||
| mockResponse.setHeader("Content-Type", "application/json"); | ||
| String expectedTenantId = "my-tenant-id"; | ||
| mockResponse.setHeader("lambda-runtime-aws-tenant-id", expectedTenantId); |
There was a problem hiding this comment.
I think it would be great to have another set of tests for:
- header not present
- header present and empty string
- header present and null value
There was a problem hiding this comment.
Thanks for the suggestion. Added these test cases.
| */ | ||
| std::chrono::time_point<std::chrono::system_clock> deadline; | ||
|
|
||
| /** |
There was a problem hiding this comment.
hopefully at some point, we won't have a copy of aws-lambda-cpp in here, so let's keep that change here but I think you also need to modify the source of truth here: https://github.com/awslabs/aws-lambda-cpp? (Not blocking for this PR to be merged) I've also created an issue for us to track that change at some point: #541
There was a problem hiding this comment.
Agreed, one day, we could get rid of this. (Not blocking PR from my end either).
| "function-arn", | ||
| null | ||
| null, | ||
| "tenant-id" |
There was a problem hiding this comment.
let's also add a test with a null value for tenant-id as it's optional
There was a problem hiding this comment.
Added test with null tenant-id.
30c667c to
b7c13ac
Compare
Issue #, if available:
Description of changes:
Target (OCI, Managed Runtime, both):
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.